function K_NS()
{
//这是51ditu坐标系统对象
	function K_51dituProjection()
	{
		this.imgSize=200;
		this.imgNtuSize=256;
	}
	K_51dituProjection.prototype=new GProjection(); 
	K_51dituProjection.prototype.fromLatLngToPixel=function(point,zoom)
	{
		var zoomUnits=Math.pow(2,17-zoom)*this.imgNtuSize/this.imgSize;
		var ntu=[point.lng()*100000,point.lat()*100000];
		return new GPoint(ntu[0]/zoomUnits,-ntu[1]/zoomUnits)
	};
	K_51dituProjection.prototype.fromPixelToLatLng=function(point,zoom,flag)
	{
		var zoomUnits=Math.pow(2,17-zoom)*this.imgNtuSize/this.imgSize;
		var latlng=[point.x*zoomUnits,-point.y*zoomUnits];
		return new GLatLng(latlng[1]/parseFloat(100000),latlng[0]/parseFloat(100000),flag)
	};
	K_51dituProjection.prototype.tileCheckRange=function(tile,zoom,tilesize)
	{
		return true;
	};

	K_51dituProjection.prototype.getWrapWidth=function(zoom)
	{
		return Math.pow(2,zoom+8);
	};

//这是调用51ditu图片的地图类型对象
	function K_51dituSpec()
	{
		GTileLayer.call(this,new GCopyrightCollection("51ditu.com"),3,17);
		this.imgURL=["http://cache2.51ditu.com/"];
	}
	K_51dituSpec.prototype=new GTileLayer();
	K_51dituSpec.prototype.getTileUrl=function(point,zoom)
	{
		var z=17-zoom;
		var nGrade=parseInt(Math.ceil((12-z)/4));
		var nPreRow=0,nPreCol=0,nPreSize=0;  
		var path="";
		for(var i=0;i<nGrade;i++)
		{
			var nSize=1<<(4*(nGrade-i));
			var nRow =parseInt((point.x-nPreRow*nPreSize)/nSize);
			var nCol =parseInt((-point.y-1-nPreCol*nPreSize)/nSize);
			path+=((nRow>9)?nRow:"0"+nRow)+""+((nCol>9)?nCol:"0"+nCol)+"/";
			nPreRow = nRow;
			nPreCol = nCol;
			nPreSize = nSize;
		}
		var id=(((point.x)&((1<<20)-1))+(((-point.y-1)&((1<<20)-1))*Math.pow(2,20))+(((z)&((1<<8)-1))*Math.pow(2,40)));
		return this.imgURL[(point.x+point.y)%this.imgURL.length]+z+"/"+path+id+".png";
	}
	K_51dituSpec.prototype.isPng=function(){return true;}
	window.K_51dituProjection=K_51dituProjection;
	window.K_51dituSpec=K_51dituSpec;
	window.K_51ditu_MAP=new GMapType([new K_51dituSpec()],new K_51dituProjection(),"51ditu",{tileSize:200,shortName:51});
}K_NS();